<?php
class Ingredient extends MySQLRecord
{
	public function __construct()
	{
		$this->id           = new PrimaryKey($this);
		$this->label        = new TextField($this, 50);
		$this->description  = new TextField($this, 50);
		$this->creationDate = new CreationTimestamp($this);
	}
}

class Recipe extends MySQLRecord
{
	public function __construct()
	{
		$this->id               = new PrimaryKey($this);
		$this->label            = new TextField($this, 50);
		$this->description      = new TextField($this, 50);
		$this->ingredients      = new ManyToMany($this, 'Ingredient');
		$this->shortDescription = new Transient($this);
		$this->bitmap           = new BitmapFile($this, new BitmapDimensions(90, null, PHORM::IMAGE_PROPORTIONAL_HEIGHT)); 
		$this->bitmap_thumbnail = new BitmapFile($this, new BitmapDimensions(64, 42, PHORM::IMAGE_CROP_FIT));
		$this->creationDate     = new CreationTimestamp($this);
		
	}
	
	public function shortDescription()
	{
		return substr($this->description, 0, 30);
	}
}



?>